home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
telecomm
/
sticpsrc.lzh
/
SOURCE.ARC
/
NETROM.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-04-29
|
11KB
|
311 lines
/* NET/ROM support definitions */
#define NR3HLEN 15 /* length of a NET/ROM level 3 hdr */
#define NR3NODESIG 0xff /* signature for nodes broadcast */
#define NR3NODEHL 7 /* nodes bc header length */
#define NR4HLEN 5 /* length of a NET/ROM level 4 hdr */
#define NR4ILEN (256-NR3HLEN-NR4HLEN) /* max length of info at level 4 */
#define NRNUMCHAINS 53 /* number of chains in the */
/* neighbor and route hash tables */
#define NRRTDESTLEN 21 /* length of destination entry in */
/* broadcast */
#define NRDESTPERPACK 11 /* maximum number of destinations per */
/* nodes packet */
#define NR4NUMCIRC 20 /* maximum number of circuits */
#if (!defined(MSDOS) || defined(LARGEDATA))
#define NETROM4 1 /* level-4 only for lots of mem */
#endif
/* Internal representation of NET/ROM network layer header */
struct nr3hdr {
struct ax25_addr source; /* callsign of origin node */
struct ax25_addr dest; /* callsign of destination node */
unsigned ttl; /* time-to-live */
};
/* Internal representation of NET/ROM routing broadcast destination */
/* entry */
struct nr3dest {
struct ax25_addr dest; /* destination callsign */
char alias[7]; /* ident, upper case ASCII, blank-filled */
struct ax25_addr neighbor; /* best-quality neighbor */
unsigned quality; /* quality of route for this neighbor */
};
/* Internal representation of NET/ROM transport layer header */
struct nr4hdr {
unsigned opcode; /* transport layer opcode */
#define NR4OMASK 0x0f /* mask to isolate opcode */
#define NR4MORE 0x20 /* more follows flag */
#define NR4NAK 0x40 /* NAK flag */
#define NR4CHOKE 0x80 /* CHOKE flag */
#define NR4CREFUSE 0x80 /* connect request refused flag */
#define NR4PID 0 /* network protocol extension */
#define NR4CONRQ 1 /* connect request */
#define NR4CONACK 2 /* connect acknowledge */
#define NR4DISRQ 3 /* disconnect request */
#define NR4DISACK 4 /* disconnect acknowledge */
#define NR4INFO 5 /* information */
#define NR4INFACK 6 /* information acknowledge */
unsigned char family,proto; /* network extension family/protocol */
struct ckt {
unsigned char index; /* circuit index */
unsigned char id; /* circuit id */
} your,my;
unsigned char txseq; /* transmit sequence number */
unsigned char rxseq; /* receive sequence number */
unsigned window; /* proposed/accepted window size */
struct ax25_addr suser; /* callsign of originating user */
struct ax25_addr snode; /* callsign of originating node */
};
/* NET/ROM interface info. linked to interface struct */
struct nriface {
char alias[7]; /* alias for this interface's node */
/* broadcasts */
unsigned char quality; /* NET/ROM link quality estimate */
char uplink; /* uplink allowed here? */
};
#define NULLNRIFACE (struct nriface *)0
/* NET/ROM neighbor table structure */
struct nrnbr_tab {
struct nrnbr_tab *next; /* doubly linked list pointers */
struct nrnbr_tab *prev;
char call[AXALEN*3]; /* call of neighbor + 2 digis max */
struct interface *interface; /* interface of neighbor's port */
unsigned refcnt; /* how many routes for this neighbor? */
unsigned failcnt; /* failure count on AX.25 link */
};
#define NULLNTAB (struct nrnbr_tab *)0
/* A list of these structures is provided for each route table */
/* entry. They bind a destination to a neighbor node. If the */
/* list of bindings becomes empty, the route table entry is */
/* automatically deleted. */
struct nr_bind {
struct nr_bind *next; /* doubly linked list */
struct nr_bind *prev;
unsigned char quality; /* quality estimate */
unsigned char obsocnt; /* obsolescence count */
unsigned char flags;
#define NRB_PERMANENT 0x01 /* entry never times out */
struct nrnbr_tab *via; /* route goes via this neighbor */
};
#define NULLNRBIND (struct nr_bind *)0
/* NET/ROM routing table entry */
struct nrroute_tab {
struct nrroute_tab *next; /* doubly linked list pointers */
struct nrroute_tab *prev;
struct nrroute_tab *sort; /* link pointer when sorting */
char alias[7]; /* alias of node */
struct ax25_addr call; /* callsign of node */
unsigned num_routes; /* how many routes in bindings list? */
struct nr_bind *routes; /* list of neighbors */
};
#define NULLNRRTAB (struct nrroute_tab *)0
/* description of a NET/ROM level 4 circuit */
struct nr_circ {
struct ckt my,your; /* circuit identifiers */
struct ax25_addr suser; /* callsign of originating user */
struct ax25_addr snode; /* callsign of originating node */
struct ax25_addr dnode; /* callsign of destination node */
unsigned window; /* proposed/accepted window size */
int state; /* connection state */
#define NR4STDISC 0 /* disconnected */
#define NR4STCPEND 1 /* connection pending */
#define NR4STCON 2 /* connected */
#define NR4STDPEND 3 /* disconnect requested locally */
unsigned char txseq; /* transmit sequence number */
unsigned char txack; /* ack'ed transmit sequence */
unsigned char rxseq; /* receive sequence number */
unsigned char mystate; /* state to send to other side */
char r_choked; /* choke received from remote */
char s_choked; /* sent choked myself */
char d_reason; /* disconnect reason */
#define NR4REDISC 0 /* disconnected */
#define NR4REFAIL 1 /* failed */
#define NR4REBUSY 2 /* busy (CHOKE) */
int retries; /* number of re-tries done */
struct mbuf *txq; /* transmit queue */
struct mbuf *rxasm; /* receive assembly buffer */
struct mbuf *rxq; /* receive queue */
struct timer trtimer; /* transport timer */
struct timer acktimer; /* ack delay timer */
struct timer noacttim; /* no-activity timer */
void (*r_upcall)(); /* receive upcall */
void (*t_upcall)(); /* transmit upcall */
void (*s_upcall)(); /* state change upcall */
char *user; /* user pointer */
};
#define NULLNRCIRC (struct nr_circ *)0
/* description of a NET/ROM level 7 user */
struct nr_user {
struct nr_user *next;
struct nr_user *prev;
struct ax25_cb *ax25_cb[2]; /* AX.25 link control blocks */
struct nr_circ *nrcirc[2]; /* NET/ROM level 4 control blocks */
#define NRU_UP 0 /* uplink (connecting user) cb's */
#define NRU_DOWN 1 /* downlink (connected user) cb's */
struct interface *iface; /* interface for connects */
int errors; /* command errors made sofar */
};
#define NULLNRUSER (struct nr_user *)0
/* The NET/ROM nodes broadcast filter structure */
struct nrnf_tab {
struct nrnf_tab *next; /* doubly linked list */
struct nrnf_tab *prev;
struct ax25_addr neighbor; /* call of neighbor to filter */
struct interface *interface; /* filter on this interface */
};
#define NULLNRNFTAB (struct nrnf_tab *)0
/* The neighbor hash table (hashed on neighbor callsign) */
extern struct nrnbr_tab *nrnbr_tab[NRNUMCHAINS];
/* The routes hash table (hashed on destination callsign) */
extern struct nrroute_tab *nrroute_tab[NRNUMCHAINS];
/* The circuit table (index on circuit index) */
extern struct nr_circ *nr_circ[NR4NUMCIRC];
/* The nodes broadcast filter table */
extern struct nrnf_tab *nrnf_tab[NRNUMCHAINS];
/* filter modes: */
#define NRNF_NOFILTER 0 /* don't filter */
#define NRNF_REJECT 1 /* reject broadcasts from stations in list */
#define NRNF_ACCEPT 2 /* accept broadcasts from stations in list */
#define NRNF_EXCLUSIVE 3 /* same as accept but only traffic from listed */
/* The filter mode */
extern unsigned nr_nfmode;
/* The time-to-live for NET/ROM network layer packets */
extern unsigned nr_ttl;
/* The obsolescence count initializer */
extern unsigned obso_init;
/* The threshhold at which routes becoming obsolete are not broadcast */
extern unsigned obso_minbc;
/* The quality threshhold below which routes in a broadcast will */
/* be ignored */
extern unsigned nr_autofloor;
/* The maximum fail count on AX.25 links to neighbors. */
/* When this is exceeded, all routes via this neighbor are */
/* dropped from the table. (except the permanen